package a.f.l.a;

import a.c.d;
import a.c.z;
import a.d.t;
import a.d.w;
import a.f.ad;
import a.f.tb;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

class gc
  extends sb
  implements p, sc
{
  private static final double f = 1.0E-006D;
  private t g;
  private eb h;
  private eb i;
  private eb j;
  private eb k;
  private eb l;
  private eb m;
  private int n;
  private int o;
  private double p;
  private double q;
  private boolean r;
  private boolean s;
  private boolean[] t;
  private List[] u;
  private r v;
  
  protected void c()
  {
    super.c();
    this.g = null;
    this.h = null;
    this.i = null;
    this.l = null;
    this.m = null;
    this.j = null;
    this.k = null;
    this.t = null;
    this.u = null;
    this.v = null;
  }
  
  protected void b(rb paramrb)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    super.b(paramrb);
    a.f.o localo = a().a();
    d locald = paramrb.d();
    o localo1 = paramrb.e();
    this.n = localo1.f().k();
    this.p = localo1.a();
    this.q = localo1.b();
    this.o = Math.min(this.n, 2 * localo1.f().a());
    if ((bool) || (this.n > 0)) {
      if (!bool) {
        if (this.q <= 0.0D) {
          if (bool) {
            break label127;
          }
        }
      }
    }
    label127:
    this.s = (this.p > 0.0D);
    if (!bool) {
      if (!this.s) {
        return;
      }
    }
    if (!bool) {
      if (this.p > 0.0D)
      {
        localObject1 = localo.v(locald.e());
        this.h = new eb(((t)localObject1).d() - this.p, ((t)localObject1).d() + ((t)localObject1).b() + this.p);
        this.i = new eb(((t)localObject1).e() - this.p, ((t)localObject1).e() + ((t)localObject1).c() + this.p);
        this.g = new t(this.h.a(), this.i.a(), this.h.d(), this.i.d());
      }
    }
    if (this.q > 0.0D)
    {
      localObject1 = localo.v(locald.f());
      this.l = new eb(((t)localObject1).d(), ((t)localObject1).d() + ((t)localObject1).b());
      this.m = new eb(((t)localObject1).e(), ((t)localObject1).e() + ((t)localObject1).c());
      this.j = new eb(((t)localObject1).d() - this.q, ((t)localObject1).d() + ((t)localObject1).b() + this.q);
      this.k = new eb(((t)localObject1).e() - this.q, ((t)localObject1).e() + ((t)localObject1).c() + this.q);
      this.t = new boolean[4];
      this.u = new List[4];
      this.v = a().a(locald);
      List localList = this.v.c(false);
      if (!bool)
      {
        if (localList != null)
        {
          if (bool) {
            break label508;
          }
          if (localList.size() != 0) {}
        }
        else
        {
          Arrays.fill(this.t, true);
        }
      }
      else {
        if (i1 == 0) {
          break label684;
        }
      }
      label508:
      Iterator localIterator = localList.iterator();
      label572:
      label622:
      do
      {
        do
        {
          ad localad;
          tb localtb;
          do
          {
            do
            {
              if (!localIterator.hasNext()) {
                break;
              }
              localad = (ad)localIterator.next();
              if (!bool)
              {
                if (localad.a() == 255)
                {
                  if (bool) {
                    break label572;
                  }
                  Arrays.fill(this.t, true);
                }
              }
              else {
                if (i1 == 0) {
                  break;
                }
              }
              localtb = a(localad.a());
            } while (localtb == null);
            if (!bool)
            {
              if (localad.b()) {
                break;
              }
              if (bool) {
                break label622;
              }
              this.t[localtb.f()] = true;
            }
          } while (i1 == 0);
          Object localObject2 = this.u[localtb.f()];
          if (!bool) {
            if (localObject2 == null)
            {
              localObject2 = new z();
              this.u[localtb.f()] = localObject2;
            }
          }
          ((List)localObject2).add(localad);
        } while (bool);
      } while (i1 == 0);
    }
    label684:
    Object localObject1 = paramrb.a();
    ((pb)localObject1).a(this);
    ((pb)localObject1).a(this);
  }
  
  private tb a(int paramInt)
  {
    switch (paramInt)
    {
    case 1: 
      return tb.c;
    case 2: 
      return tb.a;
    case 8: 
      return tb.b;
    case 4: 
      return tb.d;
    }
    return null;
  }
  
  protected void c(rb paramrb)
  {
    super.c(paramrb);
    f(paramrb);
  }
  
  protected void d(rb paramrb)
  {
    super.d(paramrb);
    f(paramrb);
  }
  
  private void f(rb paramrb)
  {
    if (this.s)
    {
      pb localpb = paramrb.a();
      localpb.b(this);
      localpb.c(this);
    }
  }
  
  double[] a(h paramh, mb parammb, jb[] paramArrayOfjb, m[] paramArrayOfm, double[] paramArrayOfDouble)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (!this.s)
      {
        b("minimal first/last segment length penalty", 0.0D, false);
        return new double[paramArrayOfjb.length];
      }
    }
    if ((this.p > 0.0D) && ((bool) || (paramh.c() != null)) && ((bool) || (!paramh.i()))) {
      if (bool) {}
    }
    this.r = (jb.a(this.g, paramh.c()));
    return super.a(paramh, parammb, paramArrayOfjb, paramArrayOfm, paramArrayOfDouble);
  }
  
  protected double a(h paramh, mb parammb, jb paramjb, m paramm, double paramDouble)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    double d1 = 0.0D;
    if (!bool)
    {
      if (this.r)
      {
        if (bool) {
          break label279;
        }
        if (this.p > 0.0D)
        {
          jb localjb = paramh.c();
          double d2 = (bool) || (localjb != null) ? paramh.a().n() : localjb.a() ? paramh.a().m() : 0.0D;
          if (!bool) {
            if (paramm.e() == 1)
            {
              if (bool) {
                break label279;
              }
              if (!(paramjb.a() ? this.h : this.i).a(paramjb.f())) {
                break label268;
              }
              d1 = this.n;
              if (bool) {
                break label279;
              }
              if (i1 == 0) {
                break label268;
              }
            }
          }
          if (!bool)
          {
            if (paramm.e() == 2)
            {
              if (bool) {
                break label279;
              }
              if (paramjb.e().a(paramjb.a() ? this.i : this.h, 1.0E-006D))
              {
                d1 = this.n;
                if (bool) {
                  break label279;
                }
                if (i1 == 0) {}
              }
            }
            else
            {
              if (bool) {
                break label279;
              }
            }
          }
          else if (paramm.e() == 3)
          {
            if (bool) {
              break label279;
            }
            if (this.g.a(paramh.a().h()) + d2 < this.p) {
              d1 = this.n;
            }
          }
        }
      }
      label268:
      if (bool) {
        break label335;
      }
    }
    if (this.q > 0.0D)
    {
      label279:
      if (bool) {
        break label325;
      }
      if (b().d(parammb))
      {
        if (bool) {
          break label325;
        }
        if (a(paramh, paramm, paramjb)) {
          d1 += this.n;
        }
      }
    }
    label325:
    a("minimal first/last segment length penalty", d1, false);
    label335:
    return d1;
  }
  
  private boolean a(h paramh, m paramm, jb paramjb)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    m localm = paramm;
    h localh = paramh;
    do
    {
      do
      {
        if (localh == null) {
          break;
        }
        if (i1 != 0) {
          break label75;
        }
        if (localm == null) {
          break;
        }
        if (!bool)
        {
          if (localm.e() != 0) {
            break;
          }
          localm = localh.j();
          localh = localh.b();
        }
      } while (i1 == 0);
    } while (bool);
    if ((localh != null) && (localm != null))
    {
      label75:
      if (!bool) {
        switch (localm.e())
        {
        case 2: 
          localObject = localh.c();
          if (!bool) {}
          return ((jb)localObject).e().b(paramjb.f()) + ((jb)localObject).d() < this.q;
        case 1: 
        case 3: 
          mb localmb = localh.a();
          eb localeb = paramjb.a() ? new eb(localmb.i(), localmb.k()) : new eb(localmb.j(), localmb.l());
          if (!bool) {}
          return localeb.b(paramjb.f()) + localeb.d() < this.q;
        }
      }
      return true;
    }
    Object localObject = paramjb.a() ? new eb(b().g().i(), b().g().k()) : new eb(b().g().j(), b().g().l());
    if (!bool) {}
    return ((eb)localObject).b(paramjb.f()) < this.q;
  }
  
  protected double b(h paramh)
  {
    boolean bool = sb.e;
    if (!bool) {
      if ((this.q > 0.0D) && ((bool) || (this.o > 0)) && ((bool) || (!b().d(paramh.a()))) && ((bool) || ((d(paramh)) && (e(paramh)))))
      {
        tb localtb = paramh.d();
        jb localjb = paramh.c();
        eb localeb1 = localtb.d() ? this.m : this.l;
        double d = 0.0D;
        eb localeb2 = eb.a(localjb.e(), localeb1);
        if (((bool) || (localeb2 != null)) && ((bool) || (localeb2.d() > 0.0D)))
        {
          if (!bool) {
            if (a(paramh, localeb2)) {
              return 0.0D;
            }
          }
          if ((bool) || (f(paramh))) {
            d = this.n;
          }
        }
        int i1 = (bool) || ((localtb == tb.b) || (localtb == tb.a)) ? 1 : 0;
        if (!bool) {
          if (i1 != 0)
          {
            if (bool) {
              break label266;
            }
            if (localjb.b() < localeb1.a()) {
              break label259;
            }
          }
        }
        label259:
        label266:
        int i2;
        if (!bool) {
          if (i1 == 0)
          {
            if (bool) {
              break label307;
            }
            if (localjb.c() > localeb1.b())
            {
              i2 = localtb.a().f();
              if ((bool) || ((this.t[i2] != 0) || ((bool) || (this.u[i2] != null)))) {
                d = this.o;
              }
            }
          }
        }
        label307:
        if (!bool) {
          if (i1 == 0)
          {
            if (bool) {
              break label368;
            }
            if (localjb.b() < localeb1.a()) {
              break label361;
            }
          }
        }
        if (!bool)
        {
          if (i1 != 0) {
            if (bool) {
              break label418;
            }
          }
        }
        else if (localjb.c() > localeb1.b())
        {
          label361:
          label368:
          i2 = localtb.b().f();
          if (!bool) {
            if (this.t[i2] == 0)
            {
              if (bool) {
                break label408;
              }
              if (this.u[i2] == null) {
                break label407;
              }
            }
          }
          d = this.o;
        }
        label407:
        label408:
        a("HEUR minimal first/last segment length penalty", d, true);
        label418:
        return d;
      }
    }
    return 0.0D;
  }
  
  private boolean d(h paramh)
  {
    boolean bool = sb.e;
    tb localtb = paramh.d();
    eb localeb = localtb.d() ? this.l : this.m;
    if ((bool) || ((localtb == tb.b) || (localtb == tb.c)))
    {
      if (!bool) {}
      return paramh.c().f() <= localeb.b();
    }
    if (!bool) {}
    return paramh.c().f() >= localeb.a();
  }
  
  private boolean e(h paramh)
  {
    eb localeb = paramh.d().d() ? this.k : this.j;
    return paramh.c().e().c(localeb);
  }
  
  private boolean a(h paramh, eb parameb)
  {
    boolean bool = sb.e;
    int i2 = sb.d;
    int i1 = paramh.d().f();
    if (!bool) {
      if (this.t[i1] != 0) {
        return true;
      }
    }
    if (!bool) {
      if (this.u[i1] == null) {
        return false;
      }
    }
    List localList = this.u[i1];
    Iterator localIterator = localList.iterator();
    while (localIterator.hasNext())
    {
      ad localad = (ad)localIterator.next();
      w localw = this.v.a(localad, false);
      double d = paramh.d().e() ? localw.a() : localw.b();
      if (parameb.a(d))
      {
        if ((bool) || (i2 != 0)) {
          break label148;
        }
        return true;
      }
    }
    label148:
    return false;
  }
  
  private boolean f(h paramh)
  {
    if (this.u[paramh.d().f()] == null) {
      return false;
    }
    eb localeb = paramh.d().d() ? this.j : this.k;
    return localeb.a(paramh.c().f());
  }
  
  public void a(h paramh, mb parammb, jb paramjb, List paramList, rb paramrb)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (!this.s) {
        return;
      }
    }
    if (!bool) {}
    int i1 = !paramjb.a() ? 1 : 0;
    jb localjb1 = paramh.c();
    jb localjb2 = paramjb;
    if ((!paramh.i()) && (localjb1 != null) && (this.p > 0.0D))
    {
      tb localtb = pb.a(paramh, parammb);
      if (localtb == paramh.d())
      {
        if (bool) {
          break label163;
        }
        if ((i1 != 0 ? this.i : this.h).a(paramjb.f()))
        {
          if (bool) {
            break label163;
          }
          if (!paramjb.e().c(localjb1.e()))
          {
            localjb2 = jb.a(localjb1, paramjb);
            if (localjb2 == null) {
              return;
            }
            paramList.add(localjb2);
          }
        }
      }
      label163:
      if (localjb1.a() == i1)
      {
        eb localeb = a(paramjb.e(), i1 != 0 ? this.h : this.i);
        if (!bool)
        {
          if (localeb != null) {
            localjb2 = new jb(localeb.a(), localeb.b(), paramjb.f(), paramjb.a());
          }
        }
        else {
          paramList.add(localjb2);
        }
      }
    }
  }
  
  private eb a(eb parameb1, eb parameb2)
  {
    boolean bool = sb.e;
    eb localeb = null;
    if ((bool) || (parameb1.a(parameb2, 1.0E-006D)))
    {
      if (!bool)
      {
        if (parameb1.c(parameb2)) {
          return localeb;
        }
        if (bool) {}
      }
      else if (parameb1.a() < parameb2.a())
      {
        return new eb(parameb1.a(), parameb2.a());
      }
      localeb = new eb(parameb2.b(), parameb1.b());
    }
    return localeb;
  }
  
  public void a(h paramh, rb paramrb, byte paramByte)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    if ((bool) || ((this.p > 0.0D) && (paramByte != 0)))
    {
      h localh = paramh.b();
      if (!bool) {
        if (localh != null)
        {
          if (bool) {
            break label74;
          }
          if (localh.c() != null) {
            break label72;
          }
        }
      }
      paramh.c(false);
      if (!bool)
      {
        if (i1 == 0) {
          return;
        }
        label72:
        label74:
        if (bool) {}
      }
      else if (localh.i())
      {
        if (bool) {
          break label102;
        }
        paramh.c(true);
        if (i1 == 0) {
          return;
        }
      }
      label102:
      if (!bool) {
        if (localh.d() == paramh.d())
        {
          if (bool) {
            break label153;
          }
          if (localh.c().e(paramh.c())) {
            break label152;
          }
        }
      }
      if (!bool)
      {
        paramh.c(true);
        if (i1 == 0) {}
      }
      else
      {
        label152:
        label153:
        paramh.c(false);
      }
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.a.gc

 * JD-Core Version:    0.7.0.1

 */